/**
**Filename: R2.c
**Authors: Maxwell Kobe, Jerry Causby, Ryan Gross
**Version: 1.8
**Last Modified: 11/24/2011
**/


#include <stdio.h>
#include "mpx_supt.h"
#include "mrj_supt.h"

pcb* findPCB(char*);
pcb* searchPCBbyName(char*);
void insertPCB(char*, pcb*);
void removePCB(char*);


pcb* findPCB(char* name)     //looks through both blocked and ready queue by name for a pcb
{
	pcb *ret = searchPCBbyName(name);
	return ret;
}

void insertPCB(char* queue, pcb* newPCB)
{
	if((queue[0] == 'b') || (queue[0] == 'B'))
	{
		enqueueBlocked(newPCB);
	}
	
	else if((queue[0] == 'r') || (queue[0] == 'R'))
	{
		enqueueReady(newPCB);
	}
	
	else
	{
		printf("Please enter either 'B' or 'R'\n");
	}
}

void removePCB(char* queue)
{
	
	if((queue[0] == 'r') || (queue[0] == 'R'))
	{
		dequeueReady();
	}
	
	else if((queue[0] == 'b') || (queue[0] == 'B'))
	{
		dequeueBlocked();
	}
}